package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30)" json:"username"`
	Password string `gorm:"type:varchar(255)" json:"password"`
}
type Shop struct {
	gorm.Model
	Name         string `gorm:"type:varchar(30)" json:"name"`
	Price        int    `gorm:"type:int" json:"price"`
	Num          int    `gorm:"type:int" json:"num"`
	Content      string `gorm:"type:varchar(30)" json:"content"`
	UserID       int    `gorm:"type:int" json:"user_id"`
	User         User   `gorm:"foreignKey:UserID" json:"user"`
	CommentCount int    `gorm:"type:int" json:"comment_count"`
}
type Comment struct {
	gorm.Model
	Content string `gorm:"type:varchar(30)" json:"content"`
	UserID  int    `gorm:"type:int" json:"user_id"`
	User    User   `gorm:"foreignKey:UserID" json:"user"`
	ShopID  int    `gorm:"type:int" json:"shop_id"`
	Shop    Shop   `gorm:"foreignKey:ShopID" json:"shop"`
}
